package com.hzhq.contract.bean.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.HashIndexed;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.index.TextIndexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.FieldType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author hzhq
 * @create 2021/3/24 5:17 下午
 * @email hzhq1255@163.com
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Document("contract")
@ApiModel("Contract")
public class Contract implements Serializable {

    @Id
    private ObjectId contractId;
    @ApiModelProperty(value = "合同名称")
    @TextIndexed
    @Field("contract_name")
    private String contractName;
    @ApiModelProperty(value = "合同种类")
    @DBRef(lazy = true)
    @Field("contract_type")
    @HashIndexed
    private ContractType contractType;
    @ApiModelProperty(value = "甲方公司")
    @DBRef(lazy = true)
    @Field("companiesA")
    private List<Company> companiesA;
    @ApiModelProperty(value = "乙方公司")
    @DBRef(lazy = true)
    @Field("companiesB")
    private List<Company> companiesB;
    @ApiModelProperty(value = "负责人")
    @Field("contact_person")
    @TextIndexed
    private String contactPerson;
    @ApiModelProperty(value = "负责人联系方式")
    @Field("contact_phone")
    private String contactPhone;
    @ApiModelProperty(value = "所属部门")
    @DBRef(lazy = true)
    @Field("depart")
    @HashIndexed
    private Depart depart;
    @ApiModelProperty(value = "合同金额")
    @Field(value = "contract_amount",targetType = FieldType.DECIMAL128)
    private BigDecimal contractAmount;
    @ApiModelProperty(value = "合同金额")
    @Field(value = "current_amount",targetType = FieldType.DECIMAL128)
    private BigDecimal currentAmount;
    @ApiModelProperty(value = "签订时间")
    @Field("start_time")
    private Date startTime;
    @ApiModelProperty(value = "截止时间")
    @Field("end_time")
    private Date endTime;
    @ApiModelProperty(value = "自定义扩展字段")
    @Field("extern_list")
    private List<Extern> externList;
    @ApiModelProperty(value = "合同创建时间")
    @Field("create_time")
    private Date createTime;
    @ApiModelProperty(value = "录入人员")
    @DBRef(lazy = true)
    @HashIndexed
    @Field("create_user")
    private User createUser;
    @ApiModelProperty(value = "id")
    @Field("template_id")
    private ObjectId templateId;
    @ApiModelProperty(value = "模板名称")
    @Field("template_name")
    @TextIndexed
    private String templateName;
    @ApiModelProperty(value = "是否删除")
    @Field("deleted")
    private Integer deleted;
    @ApiModelProperty(value = "是否编辑")
    @Field("edited")
    private Integer edited;
    @ApiModelProperty(value = "是否通过")
    @Field("passed")
    private Integer passed;
    @ApiModelProperty(value = "是否完成")
    @Field("completed")
    private Integer completed;
    @ApiModelProperty(value = "最后编辑人")
    @Field("last_edited_user")
    @TextIndexed
    private String lastEditedUser;
    @ApiModelProperty(value = "最后编辑时间")
    @Field("edited_time")
    private Date editedTime;
    @ApiModelProperty(value = "通过时间")
    @Field("passed_time")
    private Date passedTime;
    @ApiModelProperty(value = "审核人员")
    @Field("approval_person")
    @TextIndexed
    private String approvalPerson;
    @ApiModelProperty(value = "审批意见")
    @Field("approval_content")
    @TextIndexed
    private String approvalContent;




}
